home *** CD-ROM | disk | FTP | other *** search
- (*
- ===========================================================================
- BBS: Beta Connection
- Date: 08-08-93 (11:19) Number: 2152
- From: MARTIN RICHARDSON Refer#: NONE
- To: ALL Recvd: NO
- Subj: VALID DRIVES FUNCTION Conf: (232) T_Pascal_R
- ---------------------------------------------------------------------------
- Thanks for the help I got with my @Result question. Using the resposes,
- I have fixed the routine. Here is the result, a clean way to find all
- valid drives w/o having to do any kind of disk access:
- }
- {*****************************************************************************
- * Function ...... Drives
- * Purpose ....... To return a string containing the valid drives for the
- * current system.
- * Parameters .... None
- * Returns ....... A string of the valid drives.
- * Notes ......... None
- * Copyright ..... None. This routine is public domain.
- * Author ........ Martin Richardson
- * Date .......... March 3, 1993
- * August 6, 1993 (fix)
- *****************************************************************************}
- *)
-
- USES CRT;
-
- FUNCTION Drives: STRING;
- VAR
- DriveInfo: ARRAY[1..2] OF CHAR;
- Buffer: ARRAY[1..40] OF CHAR;
- DriveString: ARRAY[1..25] OF CHAR;
- BEGIN ASM
- PUSH SI
- PUSH DI
- PUSH ES
- PUSH DS
-
- MOV SI, SS
- MOV DS, SI
- MOV SI, OFFSET DriveInfo
- PUSH DS
- POP ES
- MOV DI, OFFSET Buffer
- MOV BX, OFFSET DriveString
-
- MOV BYTE PTR [SI], '#'
- XOR CX, CX
-
- @1:
- INC BYTE PTR [SI] { Next Letter }
- MOV BYTE PTR [SI+1], ':'
- MOV AX, $2906
- INT 21h
-
- MOV SI, OFFSET DriveInfo
- CMP AL, $FF
- JE @2
-
- INC CX
- PUSH CX
- MOV CL, BYTE PTR DS:[SI]
- MOV [BX], CL
- INC BX
- POP CX
-
- @2:
- CMP BYTE PTR [SI], 'Z'
- JNE @1
-
- MOV SI, OFFSET DriveString
- LES DI, @Result
- INC DI
- REP MOVSB
-
- XCHG AX, DI
- MOV DI, WORD PTR @Result
- SUB AX, DI
- DEC AX
- STOSB
-
- POP DS
- POP ES
- POP DI
- POP SI
- END; END;
-
- BEGIN
- ClrScr;
- WriteLn(DRives);
- Readkey;
- END.
-
- I have not yet gotten this to bomb. If anyone does, PLEASE LET ME KNOW!
-
- -Martin
-
- * SLMR 2.1a * And then the Nun said "No, give me the bannanna!"
- ---
- * deltaComm Online 919-481-9399 - 10 lines
- * PostLink(tm) v1.06 DELTA (#22) : RelayNet(tm) HUB